< previous page page_284 next page >

Page 284
(table continued from previous page)
Comctl32.dllThis DLL implements a set of controls called the Windows common controls. These include toolbars and an image list control.

Oleaut32.dll

This DLL contains functions that implement a variety of features relating to OLE automation. These include SAFEARRAY, BSTR, and OLE Variant functions.

Ole32.dll

This DLL contains functions that implement many of the underlying features of OLE (also known as ActiveX) technology.

wsock32.dll

This DLL implements the Winsock API. These functions are used for network communication, typically over the Internet or intranets.
Table T1-2: Common DLLs

Table T1-2 is somewhat misleading. To give you an idea why, try doing a count of the dynamic link libraries (files with a .dll extension) in the system directory on your system. For NT systems, look at the system32 directory. You'll probably find that you have well over 50 of these files. Fortunately, many of them do not expose useful functions.
Ask the DLL
A final approach for finding the correct DLL for a function is to search within the DLL itself. Microsoft's DumpBin.exe program (included with Visual Studio) and the Windows Explorer "QuickView" function can be used to obtain a list of the functions exported from a DLL. The DumpInfo program (included on the CD with this book) can also be used to obtain a list of exported functions for a DLL and has the ability to search through all of the dynamic link libraries in a directory in order to find the DLL that contains a specified function. This program, which includes full source code, also demonstrates a number of advanced API programming techniques and is discussed in detail in Tutorial 9, "Inside a DLL File."
What about Type Libraries?
There is actually another method for accessing API functions from Visual Basic programs that involves use of a type library. Type libraries are written using a language called IDL (Interface Definition Language) and are compiled using a tool called midl.exe, which is included with Visual Basic. Type libraries have the following advantages over the Declare statement:

 
< previous page page_284 next page >